﻿using sipfe.Controllers.Base;
using sipfe.model.dataAccess;
using sipfe.service.persona;
using sipfe.util;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace sipfe.Areas.Reporte.Controllers
{
    public class DatosPersonaController : BaseSipfeController
    {
        public ViewResult TabListaDatosPersonaRO(int n_IdePersona)
        {
            ViewBag.n_IdePersona = n_IdePersona;
            return View("AcordionDatosPersonaRO");
        }
        public ActionResult ListaDatosPersona(int n_IdePersona)
        {
           return View("RODatosPersona", personaById(n_IdePersona));
        }
        public ActionResult ListaDireccionPersona(int n_IdePersona,string sw)
        {
            ViewBag.sw = sw;
            //return RedirectToAction("ListaDireccionPersonaRO", "../Persona/MantePerson", new { nIdePersona = n_IdePersona });
           return View("ROReporteDireccionPersona", personaById(n_IdePersona));
        }

        public ViewResult DatosPersonalesRO(int nIdePersona)
        {
            //ViewBag.n_IdePersona = n_IdePersona;
            ViewBag.swReg = "0";
            return View(personaById(nIdePersona));
        }

        public ViewResult ReporteTabDatosPersona(int nIdePersona)
        {
            ViewBag.nIdePersona = nIdePersona;
            ViewBag.swReg = "0";
            return View();
        }
        public ViewResult ReporteTabDatosPersonaAcademica(int nIdePersona)
        {
            ViewBag.nIdePersona = nIdePersona;
            ViewBag.swReg = "0";
            return View();
        }
        public ViewResult ReporteDatosPersonaLaboral(int nIdePersona)
        {
           // string vistaPag = "";
            string vista = "ReporteDatosPersona";
            ViewBag.vistaPag = "~/Areas/Persona/Views/Shared/RODatosLaborales.cshtml";
           // vistaPag = "~/Areas/Persona/Views/Shared/RODatosEstadoCivil.cshtml";
            ViewBag.nIdePersona = nIdePersona;
            ViewBag.swReg = "0";
            return View(vista, personaById(nIdePersona));
        }

        public ViewResult ReporteDatosPersonaBeneficios(int nIdePersona)
        {
            // string vistaPag = "";
            string vista = "ReporteDatosPersona";
            ViewBag.vistaPag = "~/Areas/Persona/Views/Shared/ROBeneficios.cshtml";
            // vistaPag = "~/Areas/Persona/Views/Shared/RODatosEstadoCivil.cshtml";
            ViewBag.nIdePersona = nIdePersona;
            ViewBag.swReg = "0";
            return View(vista, personaById(nIdePersona));
        }
        public ViewResult ReporteDatosPersonaPatrimonio(int nIdePersona)
        {
            // string vistaPag = "";
            string vista = "ReporteDatosPersona";
            ViewBag.vistaPag = "~/Areas/Persona/Views/Shared/RODatosPatrimonio.cshtml";
            // vistaPag = "~/Areas/Persona/Views/Shared/RODatosEstadoCivil.cshtml";
            ViewBag.nIdePersona = nIdePersona;
            ViewBag.swReg = "0";
            return View(vista, personaById(nIdePersona));
        }

        //ReporteTabDatosLaboral

        public ViewResult ReporteGeneralesPersona(int nIdePersona, string sw)
        {
            string vista = "ReporteDatosPersona";
            string vistaPag = "";
            if (sw.Equals("1"))
            {                
              vista = "ReporteGeneralesPersona";
            } else if (sw.Equals("2")) {
              vistaPag = "~/Areas/Persona/Views/Shared/RODatosEstadoCivil.cshtml";
            }
            else if (sw.Equals("3"))
            {
                vistaPag = "~/Areas/Persona/Views/Shared/RODatosTelefono.cshtml";
            }
            else if (sw.Equals("4"))
            {
                vistaPag = "~/Areas/Persona/Views/Shared/RODatosCorreo.cshtml";
            }
            else if (sw.Equals("5"))
            {
                vistaPag = "~/Areas/Persona/Views/Shared/RODatosDireccionPersona.cshtml";
            }
            ViewBag.vistaPag = vistaPag;
            return View(vista,personaById(nIdePersona));
        }
        public ViewResult ReporteAcademicaPersona(int nIdePersona, string sw)
        {
            string vista = "ReporteDatosPersona";
            string vistaPag = "";
            if (sw.Equals("1"))
            {                
                vistaPag = "~/Areas/Persona/Views/Shared/ROCentroEstudios.cshtml";
            }
            else if (sw.Equals("2"))
            {
                vistaPag = "~/Areas/Persona/Views/Shared/ROIdiomas.cshtml";
            }
            else if (sw.Equals("3"))
            {
                vistaPag = "~/Areas/Persona/Views/Shared/ROOtrosEstudios.cshtml";
            }
            else if (sw.Equals("4"))
            {
                vistaPag = "~/Areas/Persona/Views/Shared/ROReconocimiento.cshtml";
            }
            else if (sw.Equals("5"))
            {
                vistaPag = "~/Areas/Persona/Views/Shared/ROTrabajoSocial.cshtml";
            }
            ViewBag.vistaPag = vistaPag;
            return View(vista, personaById(nIdePersona));
        }
        //<a href="RODatosDireccionPersona.cshtml">RODatosDireccionPersona.cshtml</a>
        public ViewResult ReporteTabDatosPersonaSocioEcono(int nIdePersona)
        {
            ViewBag.nIdePersona = nIdePersona;
            ViewBag.swReg = "0";
            return View();
        }

        public ViewResult ReporteSocioEconomicaPersona(int nIdePersona, string sw)
        {
            string vista = "ReporteDatosPersona";
            string vistaPag = "";

            if (sw.Equals("1"))
            {
                vistaPag = "~/Areas/Persona/Views/Shared/ROSocioEconomica.cshtml";
            }
            else if (sw.Equals("2"))
            {
                vistaPag = "~/Areas/Persona/Views/Shared/ROSocioEconomicaRefFam.cshtml";
            }
            else if (sw.Equals("3"))
            {
                vistaPag = "~/Areas/Persona/Views/Shared/ROOtrosIngresos.cshtml";
            }
            else if (sw.Equals("4"))
            {
                vistaPag = "~/Areas/Persona/Views/Shared/ROOtrosEgresos.cshtml";
            }
            ViewBag.vistaPag = vistaPag;
            return View(vista, personaById(nIdePersona));
        }

        private SIPMaePersona personaById(int n_IdePersona)
        {
            PersonaService personaService = new PersonaService();
            return personaService.personaByIdService(n_IdePersona);
        }


        //

    }
}
